package com.yoyo.yoyoplat.bean;


import android.content.Context;
import android.util.DisplayMetrics;

import com.yoyo.yoyoplat.base.ApiConstants;
import com.yoyo.yoyoplat.util.DisplayUtil;
import com.yoyo.yoyoplat.util.IntenetUtil;
import com.yoyo.yoyoplat.util.IpUtils;
import com.yoyo.yoyoplat.util.StringUtils;
import com.yoyo.yoyoplat.util.SystemUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 设备参数结构体
 */
public class DeviceDTO {

    /**
     * 用户请求ip
     */
    private String ip;
    /**
     * 设备IMEI
     */
    private String imei;
    /**
     * 操作系统类型
     */
    private Integer osType;
    /**
     * 连接类型
     */
    private Integer net;
    /**
     * http USER_AGENT
     */
    private String ua;
    /**
     * 运营商类型
     */
    private Integer carrier;
    /**
     * Mac 地址
     */
    private String mac;
    /**
     * 用户手机型号
     */
    private String md;
    /**
     * 手机系统的 APILevel
     */
    private String os;
    /**
     * Android 系统版本
     */
    private String osv;
    /**
     * 移动设备AndroidId
     */
    private String androidid;
    /**
     * 移动设备序列号
     */
    private String serialno;
    /**
     * 屏幕宽
     */
    private Integer sw;
    /**
     * 屏幕高
     */
    private Integer sh;
    /**
     * 屏幕密度
     */
    private Double dip;
    /**
     * 屏幕方向
     */
    private Integer so;
    /**
     * 手机品牌
     */
    private String br;
    /**
     * 设备类型
     */
    private Integer deviceType;

    public DeviceDTO(Context context) {
        DisplayMetrics displayMetrics = DisplayUtil.getDisplayMetrics(context);
        this.ip = StringUtils.notNull(ApiConstants.Real_IP, "222.215.91.63");
        this.imei = StringUtils.notNull(SystemUtil.getIMEI(context), "866402030341888");
        this.osType = 2;
        this.net = IntenetUtil.getNetworkState(context);
        this.ua = SystemUtil.getUserAgent(context);
        this.carrier = SystemUtil.getOperator(context);
        this.mac = IntenetUtil.getMacFromHardware();
        this.md = SystemUtil.getSystemModel();
        this.os = String.valueOf(SystemUtil.getSystemVersionInt());
        this.osv = SystemUtil.getSystemVersion();
        this.androidid = SystemUtil.getAndroidId(context);
        this.serialno = SystemUtil.getSerialNumber(context);
        this.sw = displayMetrics.widthPixels;
        this.sh = displayMetrics.heightPixels;
        this.dip = (double) displayMetrics.density;
        this.so = 1;
        this.br = SystemUtil.getDeviceBrand();
        this.deviceType = 1;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public Integer getOsType() {
        return osType;
    }

    public void setOsType(Integer osType) {
        this.osType = osType;
    }

    public Integer getNet() {
        return net;
    }

    public void setNet(Integer net) {
        this.net = net;
    }

    public String getUa() {
        return ua;
    }

    public void setUa(String ua) {
        this.ua = ua;
    }

    public Integer getCarrier() {
        return carrier;
    }

    public void setCarrier(Integer carrier) {
        this.carrier = carrier;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public String getMd() {
        return md;
    }

    public void setMd(String md) {
        this.md = md;
    }

    public String getOs() {
        return os;
    }

    public void setOs(String os) {
        this.os = os;
    }

    public String getOsv() {
        return osv;
    }

    public void setOsv(String osv) {
        this.osv = osv;
    }

    public String getAndroidid() {
        return androidid;
    }

    public void setAndroidid(String androidid) {
        this.androidid = androidid;
    }

    public String getSerialno() {
        return serialno;
    }

    public void setSerialno(String serialno) {
        this.serialno = serialno;
    }

    public Integer getSw() {
        return sw;
    }

    public void setSw(Integer sw) {
        this.sw = sw;
    }

    public Integer getSh() {
        return sh;
    }

    public void setSh(Integer sh) {
        this.sh = sh;
    }

    public Double getDip() {
        return dip;
    }

    public void setDip(Double dip) {
        this.dip = dip;
    }

    public Integer getSo() {
        return so;
    }

    public void setSo(Integer so) {
        this.so = so;
    }

    public String getBr() {
        return br;
    }

    public void setBr(String br) {
        this.br = br;
    }

    public Integer getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(Integer deviceType) {
        this.deviceType = deviceType;
    }
}
